﻿#pragma once
#include<iostream>
using namespace std;
#include"wall.h"
#include"food.h"
#include<Windows.h>

class Snake 
{
public:
	Snake(Wall &tempWall,Food &tempFood);

	enum {
		UP = 'w',
		DOWN = 's',
		LEFT = 'a',
		RIGHT = 'd'
	};

	struct Point
	{
		//数据域
		int x;
		int y;

		//指针域
		Point* next;
	};

	//初始化蛇
	void initSnake();

	//销毁节点
	void destroyPoint();

	//添加节点
	void addPoint(int x,int y);

	//删除节点
	void delPoint();

	//移动
	bool move(char key);

	//设置难度
	//获取蛇的长度
	int getList();
	//获取刷屏时间
	int getSleepTime();

	//获取分数
	int getScore();

private:
	Point* pHead;

	//维护Wall对象
	Wall& wall;

	Food& food;

	bool isRool;
};